Skip to content

Add fans and battery sensor to systemmonitor#151066

Merged
emontnemery merged 15 commits into
devfrom
gj-20250823-01
Nov 6, 2025
Merged

Add fans and battery sensor to systemmonitor#151066
emontnemery merged 15 commits into
devfrom
gj-20250823-01

Conversation

@gjohansson-ST
Copy link
Copy Markdown
Member

@gjohansson-ST gjohansson-ST commented Aug 23, 2025

Breaking change

Proposed change

Add sensors for fan rpm and battery to systemmonitor

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds fan RPM and battery sensor capabilities to the systemmonitor integration, expanding its monitoring capabilities beyond existing disk, memory, and temperature sensors.

Key changes:

  • Adds fan RPM sensors that read from psutil.sensors_fans() to display individual fan speeds
  • Adds a battery sensor that reads from psutil.sensors_battery() to show battery percentage
  • Implements proper sensor descriptions, icons, and string translations for the new sensor types

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/components/systemmonitor/conftest.py Adds mock data for fan and battery sensors in test fixtures
homeassistant/components/systemmonitor/util.py Implements read_fan_rpm() utility function to parse fan sensor data
homeassistant/components/systemmonitor/strings.json Adds translation keys for battery and fan RPM sensor names
homeassistant/components/systemmonitor/sensor.py Defines sensor descriptions and setup logic for battery and fan RPM sensors
homeassistant/components/systemmonitor/icons.json Adds icons for battery and fan RPM sensors
homeassistant/components/systemmonitor/coordinator.py Updates data coordinator to fetch fan and battery data from psutil

Comment thread homeassistant/components/systemmonitor/sensor.py Outdated
elupus
elupus previously requested changes Aug 24, 2025
Comment thread homeassistant/components/systemmonitor/binary_sensor.py Outdated
Comment thread homeassistant/components/systemmonitor/sensor.py Outdated
Comment thread homeassistant/components/systemmonitor/sensor.py Outdated
Comment thread tests/components/systemmonitor/conftest.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft August 24, 2025 16:20
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Comment thread homeassistant/components/systemmonitor/strings.json Outdated
@gjohansson-ST gjohansson-ST marked this pull request as ready for review September 18, 2025 18:34
@home-assistant home-assistant Bot requested a review from elupus September 18, 2025 18:34
Comment thread homeassistant/components/systemmonitor/binary_sensor.py Outdated
Comment thread homeassistant/components/systemmonitor/icons.json Outdated
@home-assistant home-assistant Bot marked this pull request as draft September 30, 2025 14:56
@gjohansson-ST gjohansson-ST marked this pull request as ready for review October 7, 2025 19:08
@home-assistant home-assistant Bot requested a review from joostlek October 7, 2025 19:08
Comment thread homeassistant/components/systemmonitor/sensor.py
@home-assistant home-assistant Bot marked this pull request as draft November 3, 2025 09:09
@gjohansson-ST gjohansson-ST marked this pull request as ready for review November 5, 2025 09:40
@home-assistant home-assistant Bot requested a review from emontnemery November 5, 2025 09:40
Comment thread homeassistant/components/systemmonitor/strings.json Outdated
Comment thread homeassistant/components/systemmonitor/util.py Outdated
Comment thread homeassistant/components/systemmonitor/util.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft November 6, 2025 10:13
@gjohansson-ST gjohansson-ST marked this pull request as ready for review November 6, 2025 11:19
@home-assistant home-assistant Bot requested a review from emontnemery November 6, 2025 11:19
Copy link
Copy Markdown
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @gjohansson-ST 👍

@emontnemery emontnemery dismissed stale reviews from elupus and joostlek November 6, 2025 12:08

stale

@emontnemery emontnemery merged commit 9288995 into dev Nov 6, 2025
36 checks passed
@emontnemery emontnemery deleted the gj-20250823-01 branch November 6, 2025 12:08
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants